// 寻找旋转排序数组中的最小值
//测试链接 https://leetcode.cn/problems/find-minimum-in-rotated-sorted-array/description/
public class FindMin {
    public int findMin(int[] nums) {
        int n = nums.length-1;
        int left = 0, right = n;
        while(left < right){
            int mid = left + (right - left) / 2;

            if(nums[mid] > nums[n]){
                left = mid + 1;
            }else{//nums[mid] <= nums[mid]
                right = mid ;
            }
        }
        return nums[left];
    }
}
